package cn.edu.nju.software.action.admin;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import cn.edu.nju.software.bean.show.UserShow;
import cn.edu.nju.software.util.Constants;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class ViewUserInfoAction extends ActionSupport implements SessionAware {

	private int id;
	private UserShow userShow;
	private Map<String, Object> session;
	
	public UserShow getUserShow() {
		return userShow;
	}
	
	public void setId(int id) {
		this.id = id;
	}

	@Override
	public void setSession(Map<String, Object> session) {
		this.session = session;
	}
	
	@Override
	public String execute() throws Exception {
		@SuppressWarnings("unchecked")
		Map<Integer, UserShow> usersMap = (Map<Integer, UserShow>) session.get(Constants.SESSION_USERS);
		userShow = usersMap.get(id);
		return SUCCESS;
	}
	
	
}
